package com.itheima.controller;

import com.itheima.domain.Product;
import com.itheima.service.ProductService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/product")
public class ProductController {

    @DubboReference
    private ProductService productService;

    @GetMapping("/search")
    public List<Product> search(String queryString){
        List<Product> list = productService.search(queryString);
        return list;
    }

    @PostMapping("/add")
    public void add(@RequestBody Product product){
        productService.add(product);
    }
}
